//
//  ZBViewController02.m
//  ZBOpenGLESDemo
//
//  Created by apple on 2018/7/11.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "ZBViewController02.h"
#import "ZBPaintingView.h"

@interface ZBViewController02 ()

@property (nonatomic, strong) ZBPaintingView *paintView;

@property (nonatomic, strong) UIButton *clearnButton;
@end

@implementation ZBViewController02

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.paintView];
    self.paintView.frame= CGRectMake(0, 0, 375, 400);
    self.paintView.lineColor = [UIColor redColor];
    self.paintView.lineWidth = 0.5;
    
    [self.view addSubview:self.clearnButton];
    self.clearnButton.frame = CGRectMake(200, CGRectGetMaxY(self.paintView.frame), 100, 40);
}

- (void)clearnButtonClick
{
    [self.paintView clearBoard];
}


#pragma mark - layz
- (ZBPaintingView *)paintView
{
    if(_paintView == nil)
    {
        _paintView = [[ZBPaintingView alloc]init];
        _paintView.backgroundColor = [UIColor yellowColor];
    }
    return _paintView;
}
- (UIButton *)clearnButton
{
    if(_clearnButton == nil)
    {
        _clearnButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_clearnButton setTitle:@"清除" forState:UIControlStateNormal];
        [_clearnButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        [_clearnButton addTarget:self action:@selector(clearnButtonClick) forControlEvents:UIControlEventTouchUpInside];
        _clearnButton.backgroundColor = [UIColor blueColor];
    }
    return _clearnButton;
}
@end
